package appView;

import java.awt.Color;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

import gameModel.Card;
import gameModel.Coord;
import gameModel.GameModel;
import gameModel.GridModel;
import gameModel.Piece;
import gameModel.Player;
import gameModel.StdGameModel;
import gameModel.StdGridModel;
import gameModel.StdPiece;
import gameModel.StdPlayer;
import gameModel.Case.CaseStates;
import gameModel.GameModel.Axes;

import javax.swing.SwingUtilities;

public class Test {
	
	private void display() {
		// Joueurs
		List<Player> players = new ArrayList<Player>();
		Player p1 = new StdPlayer("Nico", Color.BLUE, false);
		players.add(p1);
		Player p2 = new StdPlayer("CPU", Color.RED, true);
		players.add(p2);
		// Cartes
		Map<Player, List<Card>> cards = new HashMap<Player, List<Card>>();
		cards.put(p1, new ArrayList<Card>());
		cards.put(p2, new ArrayList<Card>());
		// Grille
		GridModel grid = new StdGridModel(4, 4);
		grid.placePiece(new Coord(1, 0), new StdPiece(p1, Piece.PieceTypes.NORMAL));
		grid.placePiece(new Coord(0, 1), new StdPiece(p1, Piece.PieceTypes.NORMAL));
		grid.placePiece(new Coord(0, 3), new StdPiece(p2, Piece.PieceTypes.NORMAL));
		grid.placePiece(new Coord(1, 1), new StdPiece(p2, Piece.PieceTypes.NORMAL));
		grid.setCaseState(new Coord(2, 1), CaseStates.WALL);
		// Jeu
		GameModel game = new StdGameModel(cards, players, grid);
		
		System.out.println(game);
		
		game.move(Axes.RIGHT);
		System.out.println("Move : RIGHT");
		
		System.out.println(game);
		
		game.move(Axes.RIGHT);
		System.out.println("Move : RIGHT");
		
		System.out.println(game);
		
		game.move(Axes.BOTTOM);
		System.out.println("Move : BOTTOM");
		
		System.out.println(game);
	}

	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				(new Test()).display();
			}
		});
	}

}
